#include <QDir>
#include <QPalette>
#include <QDesktopServices>
#include <QUrl>
#include <QMessageBox>

#include "CONST.h"
#include "fmAbout.h"
#include "ui_fmAbout.h"
#include "version.h"

using namespace Version;
using namespace Mikroakustika::MDeviceChecker;

//----------------------------------------------------------------------------------------
fmAbout::fmAbout(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::fmAbout) {

    ui->setupUi(this);
    ui->lbWWW->setOpenExternalLinks(true);
    ui->lbMail->setOpenExternalLinks(true);

//    connect(ui->lbWWW, SIGNAL(linkActivated(const QString&)), SLOT(onLabelHref(const QString&)));
//    connect(ui->lbMail, SIGNAL(linkActivated(const QString&)), SLOT(onLabelHref(const QString&)));

    QString ver(QObject::tr("Version: "));
    ver.append(QString::number(MAJOR)); //appMajorVersion
    ver.append(".");
    ver.append(QString::number(MINOR)); //appMinorVersion
    ver.append(".");
    ver.append(QString::number(REVISION));
    ver.append(".");
    ver.append(QString::number(BUILD));
    ver.append(" ");
    ver.append(verType);

    ui->lbVersion->setText(ver);
}

//----------------------------------------------------------------------------------------
fmAbout::~fmAbout() {
    delete ui;
}

//----------------------------------------------------------------------------------------
void fmAbout::changeEvent(QEvent *e) {
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

//----------------------------------------------------------------------------------------
void fmAbout::on_btnClose_clicked() {
    close();
}
